package com.oyesgo.statistics.servlet;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * @FileName StatisticeServlet.java
 * @Description: 统计主入口
 * @author rose
 * @version 1.0
 * <p>Company: OYESGO</p>
 * <p>Copyright: Copyright (c) 2010</p>
 */
public class StatisticeServlet extends HttpServlet {
	
	private static final long serialVersionUID = 1L;



	public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		this.doPost(request, response);
	}

	public void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		Cookie[] cookies = request.getCookies();
		if (cookies != null) {
			for (int i = 0; i < cookies.length; i++) {
				System.out.println(cookies[i]);
				System.out.println(cookies[i].getName());
				
			}
		}
		Cookie cookieName = new Cookie("name:","test");
		cookieName.setMaxAge(1000*60*36);
		Cookie cookiePassword = new Cookie("password:","aaabbb");
		cookiePassword.setMaxAge(1000*60*36);
		response.addCookie(cookieName);
		response.addCookie(cookiePassword);
		return;
	}

}
